﻿Shader "Custom/SkillWarning"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
		_Percent("Percent", Range(0.0,1.0)) = 0.0
		_Center("Center", Vector) = (0, 0, 0, 0)
		_TSize("TSize", Vector) = (1920, 1080, 0.0, 0.0)
    }
    SubShader
    {
        Tags { 
		"Queue" = "Transparent"
		"RenderType" = "Transparent"
		"CanUseSpriteAtlas" = "True"
	}
        LOD 100
		Blend SrcAlpha OneMinusSrcAlpha

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            // make fog work
            #pragma multi_compile_fog

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
				float3 mPos : TEXCOORD1;
                UNITY_FOG_COORDS(1)
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;

			float _Percent;
			float4 _Center;
			float4 _TSize;

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = TRANSFORM_TEX(v.uv, _MainTex);
				o.mPos = v.vertex;
                UNITY_TRANSFER_FOG(o,o.vertex);
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.uv);
                UNITY_APPLY_FOG(i.fogCoord, col);
				if (i.mPos.x < 0) {
					col.a = 0;
				}
				else {
					col.a = 1;
				}
                return col;
            }
            ENDCG
        }
    }
}
